<template>
  <el-dialog
    v-el-drag-dialog
    title="提示"
    :visible.sync="visible"
    width="600px"
    :append-to-body="true"
    @closed="reset"
  >
    <div class="content">
      <span class="name">{{ temp.userName }}</span>今日没有排班，不能接单，联系管理员给<span class="name">{{ temp.userName }}</span> 排好班即可接单
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">
        取消
      </el-button>
      <el-button v-show="menusArr.some(item => item.menuId === 1004)" type="danger" @click="toClass">
        排班
      </el-button>
      <el-button :loading="$loadingPlugin.submit" type="primary" @click="success">
        确定
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
  import { mapGetters } from 'vuex'
  export default {
    name: 'ConfirmClasses',
    props: {
      parentFun: {
        type: Function,
        default: function() {
          return
        }
      },
      parentFunction: {
        type: Function,
        default: function() {
          return
        }
      }
    },
    data() {
      return {
        visible: false,
        orderCode: '',
        temp: {}
      }
    },
    computed: {
      ...mapGetters([
        'menusArr', 'menus', 'routes', 'roles', 'organization'
      ])
    },
    methods: {
      open(temp) {
        return new Promise(resolve => {
          this.resolve = resolve
          this.visible = true
          if (temp) {
            this.temp = temp
            console.log(temp)
          }
        })
      },
      success() {
        this.visible = false
        this.parentFunction()
      },
      toClass() {
        // console.log('routes', this.routes)
        // console.log('roles', this.roles)
        // console.log('organization', this.organization)
        // console.log(this.menusArr.find(item => item.menuId === 1004))
        this.visible = false
        this.$router.push('/distributionManage/orderClass')
        this.parentFun()
      },
      cancel() {
        this.visible = false
        this.parentFunction()
      },
      reset() {
        this.temp = {}
      }
    }
  }
</script>

<style lang="scss"  scoped>
.content {
  padding: 10px 0;
  font-size: 16px;
  .name {
    font-weight: 600;
  }
}
</style>
